/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
#ifndef JCMACIJOINTGROUPCONTROL_H
#define JCMACIJOINTGROUPCONTROL_H

#include "JoystickControlComponent.h"

#include "JointGroupCtrlClient.hpp"
#include "wx/stattext.h"
#include "wx/spinctrl.h"
#include <map>
#define MJGC_STOP_BUTTON           0
#define MJGC_SPEED_BUTTON           1

#define MJGC_NAME                  "MaCI Joints"

namespace gimi {
  class GIMI;
}

class JCMaCIJointGroupControl : public JoystickControlComponent
{
public:
  JCMaCIJointGroupControl(gimi::GIMI *aGIMIPtr,
                          wxSizer *compSizer,
                          wxPanel *aComponentPanel);
  virtual ~JCMaCIJointGroupControl();
    
  virtual bool startComponent();
    
  virtual int addTarget(const gimi::GIMIService &aTarget);
    
private:
  static void commandSenderThread(void *p);
    
  MaCI::JointGroupCtrl::CJointGroupCtrlClient *iJointClient;

  //TJointInfoArray vehicleJointInfo;
  int iNumberOfJoints;

  std::map<std::string,wxSpinCtrl *> iPositionControlledJointsSpinCtrl;
  ownThreadHandle iCommandThread;
    
  gimi::GIMIService iTarget;
};

#endif // JCMACIJOINTGROUPCONTROL_H
